#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    setWindowTitle("日志");
    this->setFixedSize(600,400);
}

Dialog::~Dialog()
{
    delete ui;
}
void Dialog::showlog()
{
    QString displayString;
    QFile file("../BackupAndRestore/log.txt");
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qDebug()<<"Can't open the file!"<<endl;
    }
    while(!file.atEnd())
    {
        QByteArray line = file.readLine();
        QString str(line);
        displayString.append(str);
    }
    ui->textBrowser->clear();
    ui->textBrowser->setPlainText(displayString);
    this->exec();
}
